﻿
@{
    ViewData["Title"] = "用户注册 ";
}

<div class="container login">

    <div class="login-title">
        <strong>OSS.Core</strong>
    </div>

    <div class="col-xs-12 col-sm-6 login-body">
        <div class="title">
            <strong>
                注 &nbsp;&nbsp; 册
            </strong>
        </div>
        <form id="registe-form">
            <div class="form-group">

                <input type="text" class="form-control"
                       v-model="registe.name" name="name"
                       data-vv-as="邮箱" v-validate="'required|email'"
                       placeholder="请输入邮箱" />

                <p class="text-danger" style="display: none" v-show="errors.has('name')">{{ errors.first('name') }}</p>
            </div>
            <div class="form-group">

                <input type="password" class="form-control"
                       v-model="registe.pass_word" name="pass_word"
                       data-vv-as="密码" v-validate="'required|min:6'"
                       placeholder="请输入用户密码" />

                <p class="text-danger" style="display: none" v-show="errors.has('pass_word')">{{ errors.first('pass_word') }}</p>
            </div>
            <div class="col-sm-8 login-btn">

                <span>
                    <button type="button" @@click="submit" class="btn  btn-success">注册</button>
                </span>
            </div>
        </form>
    </div>
    <div class="col-xs-12 col-sm-6 login-footer">
        <div>第三方注册/登录</div>
        <div class="thirds">
            <span>微信</span>
        </div>
    </div>
</div>
@section Scripts
{
    <environment names="Development">
        <script src="/lib/vue/dist/vue.min.js"></script>
        <script src="/lib/vee-validate/dist/vee-validate.min.js"></script>
        <script src="/lib/vee-validate/dist/vee-validate-tips.js" asp-append-version="true"></script>
    </environment>

    <environment names="Staging,Production">
        <script src="@ViewBag.CssStaticPath/js/vue.veevalidate.min.js" asp-append-version="true"></script>
    </environment>

    <script>

        Vue.use(VeeValidate, { events: 'blur' });

        var loginVue = new Vue({
            el: "#registe-form",
            data: {
                registe: {
                    name: "",
                    pass_word: "",
                    type: 30,
                    pass_code:""
                }
            },
            methods: {
                submit: function(event) {
                    this.$validator.validateAll().then(result => {

                        var self = this;
                        var url = "/portal/registe";

                        PostApi(event.target,
                            url, self.registe,
                            function(res) {
                                if (res.ret == 0) {
                                    ShowTips("注册成功");
                                } else {
                                    ShowTip_Error(res.message);
                                }
                            });
                    });
                }
            }
        });
    </script>

}


